package com.code.day04;

import java.util.Random;
import java.util.Scanner;

public class RandomJava {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Random random = new Random();
        int number = random.nextInt(100)+1;
        while(true){
            System.out.println("请输入数字:");
            int input = sc.nextInt();
            if (input == number){
                System.out.println("恭喜你猜对了");
                break;
            } else if (input<number) {
                System.out.println("输入的数字小了");
            }else {
                System.out.println("输入的数字大了");
            }
        }
    }
}
